package com.leyuangame.core.controller.api.user;

import com.leyuangame.core.controller.bean.ResponseHandler.LeYuanResult;
import com.leyuangame.core.enums.PlayUserLogType;
import com.leyuangame.core.service.RegisterService;
import com.leyuangame.dao.repository.jpa.user.PlayUser;
import com.leyuangame.utils.ExceptionUtil;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class RegisterController {
    @Autowired
    private RegisterService registerService;

    /**
     * 用户获取手机验证码通用接口
     */
    @PostMapping(value = "/rest/getCodeByPhone",produces = "application/json")
    @ResponseBody
    public void getCodeByPhone(){

    }

    /**
     * 用户注册接口
     */
    @PostMapping(value = "/rest/registerUser",produces = "application/json")
    @ResponseBody
    public LeYuanResult registerUser(String phone, String code, String passwd,String inviteUser){
        try {
            LeYuanResult leYuanResult = registerService.registerUser(phone, code, passwd,inviteUser);
            return leYuanResult;
        }catch (Exception e){
            return new LeYuanResult().build(1,ExceptionUtil.getStackTrace(e));
        }
    }

    @Test
    public void heihei(){
        PlayUser playUser = new PlayUser();
        System.out.println();
    }
}
